<?php 


include './function.php';

if ($_POST) {

	if(!empty($_POST['username']) && !empty($_POST['content'])){

		$db = include './db.php';

		$row = $_POST;

		$row['time']=date('Y-m-d H:i:s');

		$db[$row['id']]=$row;


		$str = var_export($db,True);

		$str = "<?php return ".$str."?>";

		file_put_contents('./db.php', $str);

		header("Location: ./index.php"); 


	}else{
		echo "信息不完整，请重新输入";
	}



}else{
	$id = isset($_GET['id']) ? $_GET['id'] : '';

	if($id!=''){
		$db = include './db.php';

		$row = $db[$id];

		include './Tp/edit.html';

	}else{
		echo "非法请求";
	}
}







 ?>